home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-src.lha / gcc-2.6.3 / config / clipper / clix.h < prev    next >
C/C++ Source or Header  |  1993-12-13  |  5KB  |  164 lines

  1. /* Definitions of target machine for GNU compiler.  Clipper/Clix version.
  2.    Copyright (C) 1988, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "clipper/clipper.h"
  21.  
  22. #include "svr3.h"
  23.  
  24. /* Names to predefine in the preprocessor for this target machine.  */
  25.  
  26. #define CPP_PREDEFINES "-Dclipper -Dunix -Asystem(unix) -Asystem(svr3) -Acpu(clipper) -Amachine(clipper)"
  27.  
  28. #undef STARTFILE_SPEC
  29. #define STARTFILE_SPEC  \
  30.   "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s"
  31.  
  32. #undef ENDFILE_SPEC
  33. #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
  34.  
  35. #undef LIB_SPEC
  36.  
  37. #undef HAVE_ATEXIT
  38. #define HAVE_ATEXIT
  39.  
  40. #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)            \
  41. do {                            \
  42.   unsigned char *s;                    \
  43.   int i;                        \
  44.   for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++)    \
  45.     {                            \
  46.       if ((i % 8) == 0)                    \
  47.     fputs ("\n\t.byte\t", (FILE));            \
  48.       fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
  49.     }                            \
  50.   fputs ("\n", (FILE));                    \
  51. } while (0)
  52.  
  53. #undef ASM_OUTPUT_DOUBLE
  54. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)    \
  55. {                    \
  56.   union { int i[2]; double d; } _d_;    \
  57.   _d_.d = VALUE;                \
  58.   fprintf (FILE, "\t.long 0x%08x,0x%08x\n", _d_.i[0],_d_.i[1]); \
  59. }
  60.  
  61. #undef ASM_OUTPUT_FLOAT
  62. #define ASM_OUTPUT_FLOAT(FILE,VALUE)    \
  63. {                    \
  64.   union { int i; float f; } _f_;    \
  65.   _f_.f = VALUE;                \
  66.   fprintf (FILE, "\t.long 0x%08x\n", _f_.i); \
  67. }
  68.  
  69. /* This is how to output an assembler line
  70.    that says to advance the location counter
  71.    to a multiple of 2**LOG bytes.  */
  72.  
  73. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  74.   fprintf(FILE, "\t.align %d\n", 1 << (LOG))
  75.  
  76.  
  77. #define ASM_LONG ".long"
  78. #define BSS_SECTION_ASM_OP  ".bss"
  79. #undef INIT_SECTION_ASM_OP
  80. #define INIT_SECTION_ASM_OP ".section .init,\"x\""
  81.  
  82.  
  83. /* Define a few machine-specific details of the implementation of
  84.    constructors.
  85.  
  86.    The __CTORS_LIST__ goes in the .init section.  Define CTOR_LIST_BEGIN
  87.    and CTOR_LIST_END to contribute to the .init section an instruction to
  88.    push a word containing 0 (or some equivalent of that).
  89.  
  90.    ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
  91.    constructor.  */
  92.  
  93. #define CTOR_LIST_BEGIN                \
  94.   asm (INIT_SECTION_ASM_OP);            \
  95.   asm ("subq   $8,sp");                \
  96.   asm ("loadq  $0,r0");                \
  97.   asm ("storw  r0,(sp)")
  98.  
  99. /* don't need end marker */
  100.  
  101. #undef CTOR_LIST_END
  102.  
  103. #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)    \
  104.   do {                        \
  105.     init_section ();                \
  106.     fputs ("\tloada  ", FILE);            \
  107.     assemble_name (FILE, NAME);            \
  108.     fputs (",r0\n\tsubq   $8,sp\n\tstorw   r0,(sp)\n", FILE);    \
  109.   } while (0)
  110.  
  111.  
  112. /* fini psect is 8 aligned */
  113.  
  114. #define DTOR_LIST_BEGIN    \
  115.   asm (DTORS_SECTION_ASM_OP);                \
  116.   func_ptr __DTOR_LIST__[2] = { (func_ptr) (-1), 0 };
  117.  
  118. /* A C statement (sans semicolon) to output an element in the table of
  119.    global destructors.  */
  120.  
  121. #undef ASM_OUTPUT_DESTRUCTOR
  122. #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                       \
  123.   do {                                    \
  124.     fini_section ();                                       \
  125.     fprintf (FILE, "%s\t ", ASM_LONG);                    \
  126.     assemble_name (FILE, NAME);                              \
  127.     fprintf (FILE, ",0\n");                        \
  128.   } while (0)
  129.  
  130.  
  131. /* On clix crt1.o first calls init code and then sets environ and a valid
  132.    chrclass. Unfortunately stdio routines bomb with unset chrclass.
  133.    Therefore we set chrclass prior to calling global constructors. */
  134.  
  135. #undef DO_GLOBAL_CTORS_BODY
  136. #define DO_GLOBAL_CTORS_BODY                    \
  137. do {                                \
  138.   func_ptr *p, *beg = alloca (0);                \
  139.   _setchrclass (0);                        \
  140.   for (p = beg; *p; p+=2)                    \
  141.     ;                                \
  142.   while (p != beg)                        \
  143.     { p-= 2; (*p) (); }                        \
  144. } while (0)
  145.  
  146.  
  147. #undef DO_GLOBAL_DTORS_BODY
  148. #define DO_GLOBAL_DTORS_BODY    \
  149.   func_ptr *f = &__DTOR_LIST__[2];    /* 0,1 contains -1,0 */    \
  150.   int n = 0;                            \
  151.   while (*f)                            \
  152.     {                                \
  153.      f+= 2;                /* skip over alignment 0 */    \
  154.      n++;                            \
  155.     }                                \
  156.   f -= 2;                            \
  157.   while (--n >= 0)                        \
  158.     {                                \
  159.      (*f) ();                            \
  160.      f-= 2;                /* skip over alignment 0 */    \
  161.     }
  162.  
  163.  
  164.